<?php

function __autoload($class_name)
{
    $possible_paths = array(
        'library/',
        'library/routers/',
        'library/controllers/',
        'library/models/'
    );

    foreach ($possible_paths as $path)
    {
        if (file_exists($path . $class_name . '.php'))
        {
            require_once($path . $class_name . '.php');
            return;
        }
    }

    $exception = new FatalException('Auto load failed!');
    $exception->setDebugData('class_name', $class_name);
    throw $exception;
}

?>